package com.example.spring.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.spring.demo.entity.Goods;
import com.example.spring.demo.entity.GoodsCollect;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2024/12/31 10:50
 **/
public interface GoodsCollectMapper extends BaseMapper<GoodsCollect> {
    @Select("""
select g.*, gc.collect_id
from goods_collect as gc
left join goods as g on g.goods_id = gc.goods_id
where gc.user_id = #{userId}
""")
    IPage<Goods> getMyCollect(IPage<Goods> page, @Param("userId") Long userId);
}
